home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / c / c-bat-0.1n / c-bat-0 / c-bat-0.1 / src / debug_msg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-16  |  4.0 KB  |  105 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. #include "c-bat.h"
  5. #include "clients.h"
  6.  
  7.  
  8. main( int argc, char *argv[])
  9. { int  pid;
  10.   int  server, ret_id;
  11.   char arg1[STRINGSIZE],
  12.        arg2[STRINGSIZE],
  13.        arg3[STRINGSIZE],
  14.        arg4[ 2 * STRINGSIZE],
  15.        arg5[2 * STRINGSIZE];
  16.   short  ret,
  17.          i,
  18.          cmd,
  19.          flag,
  20.          code,
  21.          static_flag;
  22.   long   line,
  23.          m_id;
  24.    
  25.    
  26.    if( argv[1][1] == '?'  )
  27.      { fprintf(stderr, "debug_msg \nRead all messages in queue\n");
  28.        exit(1);
  29.       }
  30.    
  31.    
  32.    /* for( i = CMD_CALLS; i <= CMD_TYPEDEFS; ) */
  33.    while( 1 )
  34.      { *arg1 = 0;
  35.        *arg2 = 0;
  36.        *arg3 = 0;
  37.        *arg4 = 0;
  38.       
  39.        ret =  brs_get_msg_debug( 0, &server, &pid, &cmd ,&ret_id, &flag, arg1, arg2, arg3, arg4);
  40.       
  41.        if( ret == RET_TIMEOUT )
  42.          { /* i++;           continue; */
  43.            break;
  44.           }
  45.       
  46.        /* print message and then again with the same i */
  47.       
  48.        switch( ret )
  49.          { case RET_FILE:              printf("RET_FILE: "); break;
  50.            case RET_FUNCT:             printf("RET_FUNCT: "); break;
  51.            case RET_VAR:               printf("RET_VAR: "); break;
  52.            case RET_L_VAR:             printf("RET_L_VAR: "); break;
  53.            case RET_POS:               printf("RET_POS: "); break;
  54.            case RET_END:               printf("RET_END: "); break;
  55.            case RET_ERROR:             printf("RET_ERROR: "); break;
  56.            case RET_OK:                printf("RET_OK: "); break;
  57.            case RET_STRUCT:            printf("RET_STRUCT: "); break;
  58.            case RET_UNION:             printf("RET_UNION: "); break;
  59.            case RET_ENUM:              printf("RET_ENUM: "); break;
  60.            case RET_E_CONST:           printf("RET_E_CONST: "); break;
  61.            case RET_S_COMP:            printf("RET_S_COMP: "); break;
  62.            case RET_U_COMP:            printf("RET_U_COMP: "); break;
  63.            case RET_TYPEDEF:           printf("RET_TYPEDEF: "); break;
  64.            case RET_REFERENCE:         printf("RET_REFERENCE: "); break;
  65.            case RET_FPOS:              printf("RET_FPOS: "); break;
  66.            case RET_DIR:               printf("RET_DIR: "); break;
  67.            case RET_COMP:              printf("RET_COMP: "); break;
  68.            case RET_ENUM_C:            printf("RET_ENUM_C: "); break;
  69.            case RET_MACRO:             printf("RET_MACRO: "); break;
  70.            case RET_CONNECT:           printf("RET_CONNECT: "); break;
  71.            case RET_REFUSED:           printf("RET_REFUSED: "); break;
  72.            case RET_CMD_UNKNOWN:       printf("RET_CMD_UNKNOWN: "); break;
  73.            case RET_TIMEOUT:           printf("RET_TIMEOUT: "); break;
  74.            case RET_ABORT:             printf("RET_ABORT: "); break;
  75.            case RET_PLEASE_WAIT:       printf("RET_PLEASE_WAIT: "); break;
  76.            case CMD_CONNECT:           printf("CMD_CONNECT: "); break;
  77.            case CMD_RELEASE:           printf("CMD_RELEASE: "); break;
  78.            case CMD_TERMINATE:         printf("CMD_TERMINATE: "); break;
  79.            case CMD_SERVER:            printf("CMD_SERVER: "); break;
  80.            case CMD_SERVERKILL:        printf("CMD_SERVERKILL: "); break;
  81.            case CMD_SERVER_ID:         printf("CMD_SERVER_ID: "); break;
  82.            case CMD_SERVERTABLE:       printf("CMD_SERVERTABLE: "); break;
  83.            case CMD_S_TABLE_END:       printf("CMD_S_TABLE_END: "); break;
  84.            case CMD_NEW_FILE:          printf("CMD_NEW_FILE: "); break;
  85.            case CMD_TABLE:             printf("CMD_TABLE: "); break;
  86.            default:                    printf("??%3d ??: ", ret); break;
  87.           }
  88.       
  89.         printf(" server: %d,  client-pid %d, command sent: %hd, msg-id: %d, flag %02hx \n",
  90.                      server, pid, cmd, ret_id, flag );
  91.         if( arg1[0] ) 
  92.            printf("arg1 : \"%s\"\n", arg1 );
  93.         if( arg2[0] ) 
  94.            printf("arg2 : \"%s\"\n", arg2 );
  95.         if( arg3[0] ) 
  96.            printf("arg3 : \"%s\"\n", arg3 );
  97.         if( arg4[0] ) 
  98.            printf("arg4 : \"%s\"\n", arg4 );
  99.       }
  100.    
  101.  }
  102.       
  103.  
  104.        
  105.